home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
graphics
/
stickman.frm
< prev
next >
Wrap
Text File
|
1993-05-16
|
5KB
|
158 lines
VERSION 2.00
Begin Form Form1
Caption = "StickMan Animation Demonstration"
ClientHeight = 1245
ClientLeft = 1095
ClientTop = 1770
ClientWidth = 7425
Height = 1935
Icon = STICKMAN.FRX:0000
Left = 1035
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 1245
ScaleWidth = 7425
Top = 1140
Width = 7545
Begin Timer Timer1
Enabled = 0 'False
Interval = 50
Left = 3450
Top = 345
End
Begin PictureBox Picture3
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 480
Left = 2310
Picture = STICKMAN.FRX:0302
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 2
Top = 735
Visible = 0 'False
Width = 480
End
Begin PictureBox Picture1
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 480
Left = 0
Picture = STICKMAN.FRX:0604
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 0
Top = 780
Visible = 0 'False
Width = 480
End
Begin PictureBox Picture2
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 480
Left = 1005
Picture = STICKMAN.FRX:0906
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 1
Top = 765
Visible = 0 'False
Width = 480
End
Begin Menu FileMenu
Caption = "&File"
Begin Menu FileWalk
Caption = "&Walk"
Index = 0
Visible = 0 'False
End
Begin Menu FileReset
Caption = "&Reset"
End
Begin Menu FileSep
End
Begin Menu FileExit
Caption = "E&xit"
End
End
End
Option Explicit
Dim num As Integer
Sub FileExit_Click ()
End
End Sub
Sub FileReset_Click ()
' Make sure all our pictures start at the left and
' make the first one visible...
' Also, enable the "walk" menu item
picture1.Left = 0
picture2.Left = 0
picture3.Left = 0
picture1.Top = 750
picture2.Top = 750
picture3.Top = 750
picture1.Visible = True
picture2.Visible = False
picture3.Visible = False
FileWalk(0).Caption = "&Walk"
FileWalk(0).Visible = True
FileWalk(0).Enabled = True
num = 1
End Sub
Sub FileWalk_Click (index As Integer)
If FileWalk(0).Caption = "&Walk" Then
' Time to start walking.
timer1.Enabled = True
FileWalk(0).Caption = "&Stop"
Else
' Time to stop walking.
timer1.Enabled = False
FileWalk(0).Caption = "&Walk"
End If
End Sub
Sub Form_Load ()
FileReset_Click
End Sub
Sub Timer1_Timer ()
Const INCREMENT = 100
' First, see which picture is currently visible...
Select Case num
Case 1
' Move the next picture over, turn us off, and
' turn the next picture on...
picture1.Left = picture1.Left + INCREMENT
picture3.Visible = False
picture1.Visible = True
Case 2
' Move the next picture over, turn us off, and
' turn the next picture on...
picture2.Left = picture1.Left + INCREMENT
picture1.Visible = False
picture2.Visible = True
Case 3
' Move the next picture over, turn us off, and
' turn the next picture on...
picture3.Left = picture1.Left + INCREMENT
picture2.Visible = False
picture3.Visible = True
End Select
' Now, make sure we keep track of which picture is visible
num = num + 1
If num > 3 Then num = 1
' Check to see if we are off the edge of the form.
If picture1.Left > Form1.ScaleWidth Then
FileWalk_Click (0) ' Pretend like the user pulled "stop"
FileWalk(0).Enabled = False ' Disable the Walk option until reset
End If
End Sub